***This do-file creates Figure 6 of the paper
**Curtis RESTAT
**Change to directory where data and code were downloaded
**cd 

clear all


foreach age in A03 A04 A05 A06 A07 {
set matsize 10000
set more off
use qwi_`age'_figure6.dta,clear
do qwi_dataprep_figure6.do
unique state
gen lemps=ln(emps+1)
gen lemp=ln(empend+1)
gen lhiras=ln(hiras)
gen lseps=ln(seps)
gen hire_rate=hiras/emps
gen sep_rate=seps/emps
gen learns=ln(earns)
gen lpayroll=ln(payroll)
gen meandiff=lemp-ltemp_avg



qui areg lemp intxeastxqtrdum1-intxeastxqtrdum20 intxeastxqtrdum22-intxeastxqtrdum44 postxeast postxhigh eastxhigh trendstatedum* i.ind_qtrf [aweight=emp_weight],abs(state_ind) rob cluster(eastind)

parmest,format(estimate min95 max95) saving(qtrcoeffs_`age'.dta,replace)
use qtrcoeffs_`age',clear
keep in 1/43
rename estimate estimate_`age'
rename min95 min95_`age'
rename max95 max95_`age'


local new = _N + 1
set obs `new'
replace parm="intxeastxqtrdum21" if parm==""
replace estimate_`age'=0 if estimate_`age'==.
replace min95_`age'=0 if min95_`age'==.
replace max95_`age'=0 if max95_`age'==.
gen quarter=substr(parm,16,.)
label variable estimate_`age' "`age'"
destring quarter,replace
so quarter
so parm
drop stderr dof t p
save t_`age',replace
}

foreach set in t_A03 t_A04 t_A05 t_A06 t_A07{
	merge 1:1 parm quarter using `set'
	drop _m
}
so quarter
twoway line estimate_A03 estimate_A04 estimate_A05 estimate_A06 estimate_A07 quarter, play(fig6edit.grec) 

